package api.txSplash;

import android.app.Activity;
import android.view.ViewGroup;

import java.lang.ref.SoftReference;

public abstract class Screen_API_TX {

    public static String clazz = "api.txScreen.TX_Screen";

    private static SoftReference<Screen_API_TX> sf;

    public synchronized static Screen_API_TX getInstance() {

        if (sf == null || sf.get() == null) {
            Object o = null;
            try {
                o = Class.forName(clazz).newInstance();
            } catch (ClassNotFoundException e) {
                e.printStackTrace();
            } catch (InstantiationException e) {
                e.printStackTrace();
            } catch (IllegalAccessException e) {
                e.printStackTrace();
            } catch (IllegalArgumentException e) {
                e.printStackTrace();
            }
            if (o != null) {
                sf = new SoftReference<>((Screen_API_TX) o);
                return (Screen_API_TX) o;
            }
        }
        return sf == null ? null : sf.get();
    }

    public abstract void showHalfScreen(Activity act, String adposid, ScreenListener listener);
    public abstract void showFullScreen(Activity act, String adposid, ScreenListener listener);

    public interface ScreenListener {
        void onNoAD(String code, String msg);
        void onADReceive();
        void onADOpened();
        void onADClicked();
        void onADClosed();
        void onADLeftApplication();
        void getAdPatternType();
        void onRenderSuccess();
        void onRenderFail();
    }
}
